﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Blitzkopf
{
    public class BlitzkopfMatrix : IEnumerable
    {
        Cell[][] store;
        int dimension;

        /// <summary>
        /// Creates default matrix with dimension 6x6
        /// </summary>
        public BlitzkopfMatrix()
        {
            dimension = 6;
            Initialize();
        }

        private void Initialize()
        {
            store = new Cell[dimension][];
            for (int i = 0; i < dimension; i++)
            {
                store[i] = new Cell[dimension];
                for (int j = 0; j < dimension; j++)
                {
                    store[i][j] = new Cell();
                }
            }
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < dimension; i++)
            {
                for (int j = 0; j < dimension; j++)
                {
                    sb.Append(store[i][j]).Append(";");
                }
                sb.AppendLine();
            }
            return sb.ToString();
        }

        #region IEnumerable Members

        public IEnumerator GetEnumerator()
        {
            return store.GetEnumerator();
        }

        #endregion
    }
}
